]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView: Center workspaces of primary display
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 11 Dec 2020 18:57:49 +0000 (15:57 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sun, 24 Jan 2021 13:52:24 +0000 (10:52 -0300)
Currently workspaces are left-aligned to the allocation, which looks
odd after moving the Dash to the bottom.

Allocate workspaces centered both horizontally and vertically.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1587>

js/ui/workspacesView.js

index c57129e508e65903bb678ec2000cb0ac5b09e52a..865b52b502b80f96f495652e9b45de99c97b5830 100644 (file)
@@ -114,14 +114,17 @@ class WorkspacesView extends WorkspacesViewBase {
         const vertical = workspaceManager.layout_rows === -1;
         const rtl = this.text_direction === Clutter.TextDirection.RTL;
 
+        const [width, height] = box.get_size();
+        const childBox = box.copy();
+
         this._workspaces.forEach((child, index) => {
             if (rtl && !vertical)
                 index = nWorkspaces - index - 1;
 
-            const x = vertical ? 0 : index * this.width;
-            const y = vertical ? index * this.height : 0;
-
-            child.allocate_available_size(x, y, box.get_width(), box.get_height());
+            childBox.set_origin(
+                vertical ? 0 : index * width,
+                vertical ? index * height : 0);
+            child.allocate_align_fill(childBox, 0.5, 0.5, false, false);
         });
 
         this._updateScrollPosition();